﻿using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Eqwww.Domain;
using Microsoft.AspNetCore.Identity.UI.Services;
using Eqwww.Code;
using Eqwww.Config;
using Eqwww.App.Identity;
using Eqwww.App.Authorize;
using Eqwww.App.SystemManage;
using Eqwww.QuartzJob.Application;
using Eqwww.App.SystemSecurity;

namespace Eqwww.Web
{
    public static class ServiceExtension
    {
        public static IServiceCollection AddAppServices(this IServiceCollection services)
        {

            services.AddScoped<IEmailConfigProvider, EmailConfigProvider>();
            services.AddScoped<IEmailSender, EmailSender>();
            services.AddScoped<IVerifyCoder, DefaultVerifyCoder>();
            services.AddScoped<IAppConfigProvider, AppConfigProvider>();
            services.AddScoped<IDbBackupConfigProvider, DbBackupConfigProvider>();

            services.AddSingleton<IModelHandler, ModelHandler>();
            services.AddTransient<DatabaseLogApp>();
            services.AddTransient<RoleApp>();
            services.AddTransient<UserApp>();
            services.AddTransient<StrategoryApp>();
            services.AddTransient<AuthorizeApp>();
            services.AddTransient<ModuleApp>();
            services.AddTransient<ModuleButtonApp>();
            services.AddTransient<VersionLogApp>();

            services.AddTransient<JobApp>();
            services.AddTransient<OrganizeApp>();
            services.AddTransient<PostApp>();

            services.AddTransient<DbBackupApp>();
            services.AddTransient<IScheduleApp, DefaultScheduleApp>();

            services.AddTransient<SeedDb>();
            return services;
        }
    }
}
